﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.IO;

namespace Functionality
{
    public class AuditInformationHelper
    {
        public static void Log(string text, params object[] args)
        {
            Instance.LogTextToFile(String.Format(text, args), DateTime.Now, "User");
        }

        public static void Debug(string text, params object[] args)
        {
            Instance.LogTextToFile(String.Format(text, args), DateTime.Now, "Debug");
        }

        static AuditInformationHelper _Instance = null;
        static AuditInformationHelper Instance
        {
            get
            {
                return _Instance ?? new AuditInformationHelper();
            }
        }

        public AuditInformationHelper()
        {
            OutputStream = new StreamWriter("log.txt", false);
        }

        TextWriter OutputStream { get; set; }

        void LogTextToFile(string text, DateTime timestamp, string logType)
        {
            string toLog = String.Format("{0} ({1}): {2}", timestamp, logType, text);
            OutputStream.WriteLine(toLog);
        }
    }
}
